#include<iostream>
#include<pthread.h>
#include<unistd.h>
using namespace std;
void* thread_run(void* args)
{
    pthread_detach(pthread_self());
    cout<<(char*)args<<endl;
    pthread_exit(nullptr);
}
int main()
{
    pthread_t tid;
    if(pthread_create(&tid,nullptr,thread_run,(void*)"thread run...")!=0){
        cout<<"create error!"<<endl;
        return 1;
    }
    sleep(2);
    if(pthread_join(tid,nullptr)==0){
        cout<<"pthread_join success!"<<endl;
    }
    else{
        cout<<"pthread_join failed!"<<endl;
    }
    return 0;
}
